#ifndef __H_LOGGER_M__
#define __H_LOGGER_M__

#include <stdio.h>
#include <ctime>

#define INF 0
#define DBG 1
#define ERR 2
#define LOG_LEVEL DBG

#define LOG(level, format, ...) do{\
    if(level < LOG_LEVEL) break;\
    time_t tm = time(NULL);\
    struct tm* ltm = localtime(&tm);\
    char buffer[64] = {0};\
    strftime(buffer, 63, "%m-%d/%H:%M:%S", ltm);\
    fprintf(stdout,"[%s %s:%d]" format "\n", buffer, __FILE__, __LINE__, ##__VA_ARGS__);\
}while(0)

#define ILOG(format, ...) LOG(INF, format, ##__VA_ARGS__)
#define DLOG(format, ...) LOG(DBG, format, ##__VA_ARGS__)
#define ELOG(format, ...) LOG(ERR, format, ##__VA_ARGS__)

#endif